package com.leyou.item.interfaces.api;

import com.leyou.item.interfaces.pojo.Goods;
import com.leyou.item.interfaces.pojo.GoodsDetail;
import com.leyou.item.interfaces.pojo.Sku;
import com.leyou.item.interfaces.pojo.vo.GoodsPage;
import com.leyoucommon.pojo.PageResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @version 1.0.0
 * @Author yong.Mr
 * @data 2019-8-9
 */
public interface GoodsApi {
    /**
     * 分页查询商品
     * @param page
     * @param rows
     * @param saleable
     * @param key
     * @return
     */
    @GetMapping("/spu/page")
    PageResult<GoodsPage> queryBrandByPage(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "rows", defaultValue = "5") Integer rows,
            @RequestParam(value = "saleable", defaultValue = "true") Boolean saleable,
            @RequestParam(value = "key", required = false) String key);

    /**
     * 根据spu商品id查询详情
     * @param id
     * @return
     */
    @GetMapping("/spu/detail/{id}")
    GoodsDetail querySpuDetailById(@PathVariable("id") Long id);

    /**
     * 根据spu的id查询sku
     * @param id
     * @return
     */
    @GetMapping("sku/list")
    List<Sku> querySkusBySpuId(@RequestParam("id") Long id);

    @GetMapping("{id}")
    public Goods querySpuById(@PathVariable("id") Long id);
}
